import 'dart:convert';

BasketsResult basketsResultFromJson(String str) =>
    BasketsResult.fromJson(json.decode(str));

String basketsResultToJson(BasketsResult data) => json.encode(data.toJson());

class BasketsResult {
  BasketsResult({
    this.limit,
    this.page,
    this.count,
    this.list,
  });

  int? limit;
  int? page;
  int? count;
  List<BasketItem>? list;

  factory BasketsResult.fromJson(Map<String, dynamic> json) => BasketsResult(
        limit: json["limit"],
        page: json["page"],
        count: json["count"],
        list: json["list"] != null
            ? List<BasketItem>.from(
                json["list"].map((x) => BasketItem.fromJson(x)))
            : null,
      );

  Map<String, dynamic> toJson() => {
        "limit": limit,
        "page": page,
        "count": count,
        "list": list != null
            ? List<dynamic>.from(list!.map((x) => x.toJson()))
            : null,
      };
}

class BasketItem {
  BasketItem({
    this.id,
    this.bookImageUrl,
    this.bookId,
    this.bookTitle,
    this.player,
    this.assignmentId,
    this.assignmentName,
    this.contentType,
    this.status,
    this.when,
    this.content,
    this.classId,
    this.classCode,
  });

  String? id;
  String? bookImageUrl;
  String? bookId;
  String? bookTitle;
  Player? player;
  String? assignmentId;
  String? assignmentName;
  String? contentType;
  String? status;
  int? when;
  Content? content;
  String? classId;
  String? classCode;

  factory BasketItem.fromJson(Map<String, dynamic> json) => BasketItem(
        id: json["id"],
        bookImageUrl: json["bookImageUrl"],
        bookId: json["bookId"],
        bookTitle: json["bookTitle"],
        player: json["player"] != null ? Player.fromJson(json["player"]) : null,
        assignmentId: json["assignmentId"],
        assignmentName: json["assignmentName"],
        contentType: json["contentType"],
        status: json["status"],
        when: json["when"],
        content:
            json["content"] != null ? Content.fromJson(json["content"]) : null,
        classId: json["classId"],
        classCode: json["classCode"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "bookImageUrl": bookImageUrl,
        "bookId": bookId,
        "bookTitle": bookTitle,
        "player": player != null ? player?.toJson() : null,
        "assignmentId": assignmentId,
        "assignmentName": assignmentName,
        "contentType": contentType,
        "status": status,
        "when": when,
        "content": content != null ? content?.toJson() : null,
        "classId": classId,
        "classCode": classCode,
      };
}

class Content {
  Content({
    this.id,
    this.entry,
    this.status,
    this.lastReviewedAt,
    this.gradedAt,
    this.sent,
    this.timestamp,
    this.grade,
    this.comment,
    this.location,
    this.text,
  });

  String? id;
  String? entry;
  String? status;
  int? lastReviewedAt;
  int? gradedAt;
  bool? sent;
  int? timestamp;
  String? grade;
  String? comment;
  String? location;
  String? text;

  factory Content.fromJson(Map<String, dynamic> json) => Content(
        id: json["id"],
        entry: json["entry"] == null ? null : json["entry"],
        status: json["status"],
        lastReviewedAt: json["lastReviewedAt"],
        gradedAt: json["gradedAt"],
        sent: json["sent"],
        timestamp: json["timestamp"],
        grade: json["grade"] == null ? null : json["grade"],
        comment: json["comment"] == null ? null : json["comment"],
        location: json["location"] == null ? null : json["location"],
        text: json["text"] == null ? null : json["text"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "entry": entry == null ? null : entry,
        "status": status,
        "lastReviewedAt": lastReviewedAt,
        "gradedAt": gradedAt,
        "sent": sent,
        "timestamp": timestamp,
        "grade": grade == null ? null : grade,
        "comment": comment == null ? null : comment,
        "location": location == null ? null : location,
        "text": text == null ? null : text,
      };
}

class Player {
  Player({
    this.firstName,
    this.lastName,
    this.userName,
  });

  String? firstName;
  String? lastName;
  String? userName;

  factory Player.fromJson(Map<String, dynamic> json) => Player(
        firstName: json["firstName"],
        lastName: json["lastName"],
        userName: json["userName"],
      );

  Map<String, dynamic> toJson() => {
        "firstName": firstName,
        "lastName": lastName,
        "userName": userName,
      };
}
